﻿#if UNITY_EDITOR
using UnityEngine;


/// <summary>
/// Animator ControllerParameter
/// </summary>
public class ESF_SkillAnimatorControllerParameter
{
    /// <summary>
    /// 参数
    /// </summary>
    public AnimatorControllerParameter parameter { get; private set; }
    /// <summary>
    /// 是否是触发器
    /// </summary>
    public bool isTrigger { get; private set; }
    /// <summary>
    /// 参数类型
    /// </summary>
    public AnimatorControllerParameterType type { get; private set; }
    /// <summary>
    /// 类型名称
    /// </summary>
    public string typeName { get; private set; }
    /// <summary>
    /// 属性名称
    /// </summary>
    public string name { get; private set; }
    /// <summary>
    /// 名称Summary
    /// </summary>
    public string nameSummary { get; private set; }
    /// <summary>
    /// 名称Hash值
    /// </summary>
    public int nameHash { get; private set; }
    /// <summary>
    /// 方法类型
    /// </summary>
    public string methodType { get; private set; }
    /// <summary>
    /// 构造函数
    /// </summary>
    /// <param name="_parameter">参数</param>
    public ESF_SkillAnimatorControllerParameter(AnimatorControllerParameter _parameter)
    {
        parameter = _parameter;
        type = _parameter.type;
        isTrigger = _parameter.type == AnimatorControllerParameterType.Trigger;

        AnimatorControllerParameterType csType = _parameter.type;
        switch (_parameter.type)
        {
            case AnimatorControllerParameterType.Trigger:
                csType = AnimatorControllerParameterType.Bool;
                break;
        }

        switch (_parameter.type)
        {
            case AnimatorControllerParameterType.Int:
                methodType = "Integer";
                break;
            default:
                methodType = type.ToString();
                break;
        }
        typeName = csType.ToString().ToLower();
        name = $"{_parameter.type}_{_parameter.name}";
        nameHash = _parameter.nameHash;
        nameSummary = name.ESF_ToSummary();
    }
}
#endif
